# coding:utf-8

import numpy as np
import matplotlib.pyplot as plt

mat1 = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9]).reshape((3, 3))
print mat1
print type(mat1)
mat2 = np.array([1, 2, 3]).reshape((3, 1))
print mat2
print np.dot(mat1, mat2)

csvmat = np.genfromtxt('./csv.txt', delimiter=',', dtype=str)  # type:np.ndarray
csvmat = csvmat.reshape((2, 4))
print csvmat

matrix = np.array([[5, 10, 15], [20, 25, 30]])
print(matrix.shape)
print(matrix == 15)
print(matrix[matrix == 15])

matrix = matrix.astype('uint8')
print matrix.dtype
